﻿Ext.define('Ext.ux.desktop.LoadingModule', {
    extend: 'Ext.ux.desktop.Module',
    winId: '', // id
    text: '', // 标题及菜单名
    iconCls: '', // 小图标
    largeIconCls: '', // 大图标
    maximized: false, // 是否最大化打开
    url: '',
    init: function () {
        this.launcher = {
            winId: this.winId,
            text: this.text,
            iconCls: this.iconCls,
            largeIconCls: this.largeIconCls,
            maximized: this.maximized,
            url: this.url,
            handler: this.createWindow,
            scope: this
        }
    },
    createWindow: function (src) {
        var me = src;
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow(me.winId);
        if (!win) {
            win = desktop.createWindow({
                id: me.winId,
                title: me.text,
                maximized: me.maximized,
                iconCls: me.iconCls,
                largeIconCls: me.largeIconCls,
                hideMode: 'offsets',
                constrain: true,
                layout: 'fit',
                loader: {
                    url: me.url,
                    autoLoad: true,
                    scripts: true
                }
            });
        }
        win.show();
        return win;
    }
});
